package cn.edu.tju.elm.service;

import cn.edu.tju.elm.model.DeliveryAddress;
import cn.edu.tju.core.model.User;

import java.util.List;
import java.util.Optional;

public interface AddressService {
	DeliveryAddress addAddress(DeliveryAddress address, User currentUser);
	DeliveryAddress updateAddress(Long id, DeliveryAddress addressDetails, User currentUser);
    void deleteAddress(Long id, User currentUser);
    Optional<DeliveryAddress> findById(Long id);
    List<DeliveryAddress> findByCustomer(User customer);
    Optional<DeliveryAddress> findDefaultByCustomer(User customer);
    DeliveryAddress save(DeliveryAddress address);
    void deleteById(Long id);
    DeliveryAddress setDefaultAddress(Long addressId, User customer);
    boolean belongsToUser(Long addressId, User customer);
    
    // 新增方法
    long countByCustomer(User customer);
    boolean existsByIdAndCustomer(Long id, User customer);
    List<DeliveryAddress> findByCustomerOrderByCreateTimeDesc(User customer);
}